//
// Created by ub on 2020/11/1.
//
#include <iostream>
using namespace std;
unsigned int c_in_str(const char * str ,char ch);
/*int main ()
{
    char mmm[15] = "minimum";
    char *wail = "ululate";
    unsigned int ms = c_in_str(mmm,'m');
    unsigned int us = c_in_str(wail,'u');
    cout << ms << " m characters in" << mmm << endl;
    cout << us << " u characters in" << wail <<endl;
    return 0;
}*/
// this function counts the number of ch characters
unsigned int c_in_str(const char *  str , char ch)
{
  unsigned int count = 0;
  while(*str) // quit when *str is '\n'
  {
     if(*str == ch) count ++;
     str++; // move pointer to next char
  }
  return count;
}